<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script src="https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.14/vue.js" type="application/javascript"></script>
</head>
<body>
    <div id="app">
      <tom></tom>
      <jerry></jerry>
    </div>
</body>
<script>
  Vue.mixin({
    data(){
      return {
        username:'hh'
      }
    },
    created(){
      console.log('zz')

    },
    methods:{
      hasPermission(){
        return true
      }
    }
    })
    Vue.component('tom',{
      data(){
        return {
          username:'dd'
        }
      },
      created(){
        console.log('====')

      },
      template: `<div>tom-{{hasPermission()}}-{{username}}</div>`
    })

    let obj = {
      data(){
        return {
          username:'tt'
        }
      }
    }
    Vue.component('jerry',{
      mixins:[obj],
      template: `<div>jerry-{{hasPermission()}}-{{username}}</div>`
    })
    new Vue({
        el: '#app'
    })
</script>
</html>
